package com.skypan.ndk01;

import androidx.appcompat.app.AppCompatActivity;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import java.security.MessageDigest;

public class MainActivity extends AppCompatActivity {
    final static String TAG = "MainActivaty";



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        // Example of a call to a native method
        TextView tv = findViewById(R.id.sample_text);

        PackageInfo packageInfo = null;
        try {
            packageInfo = getPackageManager().getPackageInfo(getOpPackageName(), PackageManager.GET_SIGNATURES);
        }catch (PackageManager.NameNotFoundException e){
            e.printStackTrace();
        }

        Signature[] signatures = packageInfo.signatures;
        Log.i(TAG,signatures[0].toCharsString());



        String signature = SignatureUtils.signatureParams("userName=123456&userPwd=abcdef");
        tv.setText(signature);

    }


}